import 'dart:math';

import 'package:flutter/material.dart';

void main() => runApp(MaterialApp(
      home: HomePage(),
    ));

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> with SingleTickerProviderStateMixin {
  Animation<double> _animation;
  AnimationController _animationController;
  bool _reversed = false;

  var images = [
    "assets/images/img1.jpg",
    "assets/images/img1.jpg",
    "assets/images/img1.jpg",
    "assets/images/img1.jpg",
    "assets/images/img1.jpg",
    "assets/images/img1.jpg",
    "assets/images/img1.jpg",
  ];

  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
    _animationController.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return (Scaffold(
        appBar: AppBar(
          title: Text("list3d"),
        ),
        body: Center(
          child: ListWheelScrollView(
            perspective: 0.003,
            diameterRatio: 3.0,
            itemExtent: MediaQuery.of(context).size.height * 0.6,
//            children: List.generate(20, (index) => index)
//                .map((e) => Text(
//                      e.toString(),
//                      style: TextStyle(color: Colors.red, fontSize: 25),
//                    ))
//                .toList(),
            children: images
                .map((e) => Card(
                      clipBehavior: Clip.antiAlias,
                      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
                      child: Stack(
                        fit: StackFit.expand,
                        alignment: Alignment.center,
                        children: <Widget>[
                          Image.asset(
                            e,
                            fit: BoxFit.cover,
                          ),
                          Positioned(
                            bottom: 30,
                            left: 30,
                            child: Text(
                              "aaa",
                              style: TextStyle(fontSize: 20, color: Colors.red),
                            ),
                          )
                        ],
                      ),
                    ))
                .toList(),
          ),
        )));
  }

  void _doAnimation() {
    _reversed ? _animationController.reverse() : _animationController.forward();
    _reversed = !_reversed;
  }
}
